package cn.glc.daily.life.infrastructure.dao;

import cn.glc.daily.life.infrastructure.po.UserAuthsPo;
import cn.glc.daily.life.infrastructure.po.UserPo;
import cn.glc.daily.life.model.to.UserTo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

/**
 * @author simon
 * @date 2020/5/28 17:26
 * @copyright:
 * @modifier
 * @motto a no talent, people who have to study hard
 */
@Component
public interface UserDao extends BaseMapper<UserPo> {

    /**
     * 按用户名查询用户
     *
     * @param uid
     * @return
     */
    UserTo findDetailsByUid(@Param("uid") Long uid);

    /**
     * 根据用户名密码查询用户
     *
     * @param userName
     * @return
     */
    UserAuthsPo findUserAuthsByUserName(@Param("email") String userName);

    /**
     * 根据邮箱查询用户
     *
     * @param userName
     * @return
     */
    UserAuthsPo findUserAuthsByEmail(@Param("email") String userName);

    /**
     * 用户注销
     *
     * @param uid
     * @return
     */
    Boolean accountClose(@Param("uid") Long uid);
}
